package com.cat.simulation;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/ugly-number-ii/description/
 * @create 2025/8/26 19:05
 * @since JDK17
 */

public class Solution01 {
    public int getWinner(int[] arr, int k) {
        int ans = 0, n = arr.length, cnt = 0;
        for (int i = 0; i < n; i++) {
            if (ans > arr[i]) {
                cnt++;
            } else {
                ans = arr[i];
                cnt = 1;
            }
            if (cnt >= k) {
                return ans;
            }
        }
        return ans;
    }
}
